//
//  TraderAddStoreViewController.m
//  WGFGlobalHouses
//
//  Created by zhouhui on 15/4/19.
//  Copyright (c) 2015年 waiguofang. All rights reserved.
//  添加门店

#import "TraderAddStoreViewController.h"
#import "GrayView.h"
#import "UIView+circular.h"
#import "UIView+tapAction.h"
#import "PickView.h"

@interface TraderAddStoreViewController ()<UIPickerViewDelegate,UIPickerViewDataSource>
//门店所在地址
@property (weak, nonatomic) IBOutlet UILabel *address;
//门店名称
@property (weak, nonatomic) IBOutlet UITextField *storeName;
@property (weak, nonatomic) UIView * grayView;
/**
 *  保存信息
 */
- (IBAction)clickSaveBtn;
- (IBAction)selectAddress;

@property (weak, nonatomic) IBOutlet UIPickerView *pickView;


@end

@implementation TraderAddStoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


/**
 *  保存信息
 */
- (IBAction)clickSaveBtn {
}

/**
 *  选择地址
 */
- (IBAction)selectAddress {
    
    [self addGrayView];
//    [self addPickView];
}

/**
 *  添加灰色的view
 */
-(void)addGrayView
{
    CGFloat height = UIScreenHeight*(150/480.0);
    CGFloat Y = UIScreenHeight - height;
    
    UIView *grayView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, UIScreenWidth, Y)];
    [grayView setBackgroundColor:[UIColor grayColor]];
    grayView.alpha = 0.5;
    self.grayView = grayView;
    [self.grayView addTapGestureWithTarget:self action:@selector(hiddenGrayView)];
    [self.view addSubview:self.grayView];
}
/**
 *  隐藏灰色的view
 */
-(void)hiddenGrayView
{
    self.grayView.hidden = YES;
   
}

//-(void)addPickView
//{
//    PickView *pickView = [PickView pickViewInitWithXib];
//    CGFloat pickViewH = pickView.frame.size.height;
//    NSLog(@"%f",pickViewH);
//    pickView.frame = CGRectMake(0, UIScreenHeight- pickViewH*(480.0/UIScreenHeight) ,UIScreenWidth, pickViewH*(480.0/UIScreenHeight));
////    pickView.frame = CGRectMake(0, 330, 320, 150);
//    self.pickView.pickView.delegate = self;
//    self.pickView.pickView.dataSource = self;
//    self.pickView = pickView;
//    [self.view addSubview:self.pickView];
//}


- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
{
    if (component == 0)
    {
        return @"所在地区";
    }
    else
    {
        return @"区域";
    }
}
// returns the number of 'columns' to display.
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
{
    return 2;
}

// returns the # of rows in each component..
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
{
    return 10;
}

@end
